// 请求出库类别
import {
    getOutTypes
} from '@/apis'
const getOutStoreType = {
    data () {
        return {
            // 出库类别
            outstoreTypes: []
        }
    },
    methods: {
        // 获取出库类别
        async getOutTypes () {
            try {
                let deptId = window.localStorage.getItem('organizationId');// 99
                let res = await getOutTypes(deptId);
                console.log('获取出库类别', res);
                let {
                    code,
                    msg,
                    data
                } = res.data;
                if (code == 200) {
                    this.outstoreTypes = data;
                } else if (code == -2) {
                    this.$message({
                        type: 'error',
                        message: `${msg}`
                    })
                    this.$store.commit('CLEAR_LOGIN');
                    this.$router.push('/login').catch({});    
                } else {
                    this.$message({
                        type: 'error',
                        message: `${msg}`
                    })
                }
            } catch(e) {
                console.log('获取出库类别',e)
            }
        }
    }
}

export {
    getOutStoreType
}